********************************************************************************
*********************           March for Science              *****************
*********************         -- motta018@umn.edu --           *****************
********************************************************************************

********************************************************************************
* Read in the Data
********************************************************************************

clear
cd "YOUR DIRECTORY"
use "r&p_replicationdata.dta"


********************************************************************************
* REPLICATION OF TABLE ONE [MAIN TEXT]
********************************************************************************

** WITH CONTROLS

	** Scientist Affect 

	diff scift if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libcons) cluster(workerId) 

	** College Professors

	diff profft if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libcons) cluster(workerId)

	** Intellectuals

	diff intelft if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libcons) cluster(workerId) 
	
	** FT Index
	
	diff sciaffindex if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libcons) cluster(workerId) 
			
	** Sci, Personal Gain

	diff personalgain if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libcons) cluster(workerId) 
		
	** Experts = Untrustworthy

	diff untrustexp if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libcons) cluster(workerId)
		
	** AD Index
	
	diff sciindexad if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libcons) cluster(workerId) 
		
	** Can't Trust Most Sci Research

	diff untrustscir if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libcons) cluster(workerId) 
		
	** Politically Motivated

	diff polmotive if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libcons) cluster(workerId)
		
	** Research Index
	
	diff research if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libcons) cluster(workerId) 
		
** WITHOUT CONTROLS

	** Scientist Affect 

	diff scift if tookw2==1,  ///
		period(wave_alt) treated(libcons) cluster(workerId) 

	** College Professors

	diff profft if tookw2==1,  ///
		period(wave_alt) treated(libcons) cluster(workerId)

	** Intellectuals

	diff intelft if tookw2==1,  ///
		period(wave_alt) treated(libcons) cluster(workerId) 
	
	** FT Index
	
	diff sciaffindex if tookw2==1,  ///
		period(wave_alt) treated(libcons) cluster(workerId) 
			
	** Sci, Personal Gain

	diff personalgain if tookw2==1,  ///
		period(wave_alt) treated(libcons) cluster(workerId) 
		
	** Experts = Untrustworthy

	diff untrustexp if tookw2==1,  ///
		period(wave_alt) treated(libcons) cluster(workerId)
		
	** AD Index
	
	diff sciindexad if tookw2==1,  ///
		period(wave_alt) treated(libcons) cluster(workerId) 
		
	** Can't Trust Most Sci Research

	diff untrustscir if tookw2==1, ///
		period(wave_alt) treated(libcons) cluster(workerId) 
		
	** Politically Motivated

	diff polmotive if tookw2==1,  ///
		period(wave_alt) treated(libcons) cluster(workerId)
		
	** Research Index
	
	diff research if tookw2==1,  ///
		period(wave_alt) treated(libcons) cluster(workerId) 

********************************************************************************
* Asymmetric Attrition Checks
********************************************************************************

keep if wave==1

ttest scift, by(tookw2)
	* t = 0.63, p > 0.10
ttest profft, by(tookw2)
	* t = 1.53, p < 0.10
ttest intelft, by(tookw2)
	* t = 1.14, p > 0.10
ttest personalgain, by(tookw2)
	* t = -0.31, p > 0.10
ttest untrustexp, by(tookw2)
	* t = -0.44, p > 0.10
ttest polmotive, by(tookw2)
	* t = 0.14, p > 0.10
ttest untrustscir, by(tookw2)
	* t = -0.91, p > 0.10

********************************************************************************
* Placebo Check
********************************************************************************

clear
cd "YOUR DIRECTORY"
use "r&p_replicationdata.dta"

** NO CONTROLS

	** Muslim

	diff muslim if tookw2==1, ///
		period(wave_alt) treated(libcons) cluster(workerId) 
		
	** Immigrant

	diff imm if tookw2==1,  ///
		period(wave_alt) treated(libcons) cluster(workerId)

** CONTROLS

	** Muslim

	diff muslim if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libcons) cluster(workerId)
		
	** Immigrant

	diff imm if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libcons) cluster(workerId)
		
********************************************************************************
* Robustness Check #1: Re-do DiD w/ PID
********************************************************************************

** WITH CONTROLS

	** Scientist Affect 

	diff scift if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(demgop) cluster(workerId) 

	** College Professors

	diff profft if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(demgop) cluster(workerId)

	** Intellectuals

	diff intelft if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(demgop) cluster(workerId) 
	
	** FT Index
	
	diff sciaffindex if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(demgop) cluster(workerId) 
			
	** Sci, Personal Gain

	diff personalgain if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(demgop) cluster(workerId) 
		
	** Experts = Untrustworthy

	diff untrustexp if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(demgop) cluster(workerId)
		
	** AD Index
	
	diff sciindexad if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(demgop) cluster(workerId) 
		
	** Can't Trust Most Sci Research

	diff untrustscir if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(demgop) cluster(workerId) 
		
	** Politically Motivated

	diff polmotive if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(demgop) cluster(workerId)
		
	** Research Index
	
	diff research if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(demgop) cluster(workerId) 
		
** WITHOUT CONTROLS

	** Scientist Affect 

	diff scift if tookw2==1,  ///
		period(wave_alt) treated(demgop) cluster(workerId) 

	** College Professors

	diff profft if tookw2==1,  ///
		period(wave_alt) treated(demgop) cluster(workerId)

	** Intellectuals

	diff intelft if tookw2==1,  ///
		period(wave_alt) treated(demgop) cluster(workerId) 
	
	** FT Index
	
	diff sciaffindex if tookw2==1,  ///
		period(wave_alt) treated(demgop) cluster(workerId) 
			
	** Sci, Personal Gain

	diff personalgain if tookw2==1,  ///
		period(wave_alt) treated(demgop) cluster(workerId) 
		
	** Experts = Untrustworthy

	diff untrustexp if tookw2==1,  ///
		period(wave_alt) treated(demgop) cluster(workerId)
		
	** AD Index
	
	diff sciindexad if tookw2==1,  ///
		period(wave_alt) treated(demgop) cluster(workerId) 
		
	** Can't Trust Most Sci Research

	diff untrustscir if tookw2==1, ///
		period(wave_alt) treated(demgop) cluster(workerId) 
		
	** Politically Motivated

	diff polmotive if tookw2==1,  ///
		period(wave_alt) treated(demgop) cluster(workerId)
		
	** Research Index
	
	diff research if tookw2==1,  ///
		period(wave_alt) treated(demgop) cluster(workerId) 		

********************************************************************************
* Robustness Check #2: Redo DiD for Lib v. Moderates
********************************************************************************

gen libmod=.
	replace libmod=0 if libmodcons==1
	replace libmod=1 if libmodcons==2
	fre libmod

** WITH CONTROLS

	** Scientist Affect 

	diff scift if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libmod) cluster(workerId) 

	** College Professors

	diff profft if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libmod) cluster(workerId)

	** Intellectuals

	diff intelft if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libmod) cluster(workerId) 
	
	** FT Index
	
	diff sciaffindex if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libmod) cluster(workerId) 
			
	** Sci, Personal Gain

	diff personalgain if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libmod) cluster(workerId) 
		
	** Experts = Untrustworthy

	diff untrustexp if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libmod) cluster(workerId)
		
	** AD Index
	
	diff sciindexad if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libmod) cluster(workerId) 
		
	** Can't Trust Most Sci Research

	diff untrustscir if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libmod) cluster(workerId) 
		
	** Politically Motivated

	diff polmotive if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libmod) cluster(workerId)
		
	** Research Index
	
	diff research if tookw2==1, cov(educ female black hisp inc age polint) ///
		period(wave_alt) treated(libmod) cluster(workerId) 
		
** WITHOUT CONTROLS

	** Scientist Affect 

	diff scift if tookw2==1,  ///
		period(wave_alt) treated(libmod) cluster(workerId) 

	** College Professors

	diff profft if tookw2==1,  ///
		period(wave_alt) treated(libmod) cluster(workerId)

	** Intellectuals

	diff intelft if tookw2==1,  ///
		period(wave_alt) treated(libmod) cluster(workerId) 
	
	** FT Index
	
	diff sciaffindex if tookw2==1,  ///
		period(wave_alt) treated(libmod) cluster(workerId) 
			
	** Sci, Personal Gain

	diff personalgain if tookw2==1,  ///
		period(wave_alt) treated(libmod) cluster(workerId) 
		
	** Experts = Untrustworthy

	diff untrustexp if tookw2==1,  ///
		period(wave_alt) treated(libmod) cluster(workerId)
		
	** AD Index
	
	diff sciindexad if tookw2==1,  ///
		period(wave_alt) treated(libmod) cluster(workerId) 
		
	** Can't Trust Most Sci Research

	diff untrustscir if tookw2==1, ///
		period(wave_alt) treated(libmod) cluster(workerId) 
		
	** Politically Motivated

	diff polmotive if tookw2==1,  ///
		period(wave_alt) treated(libmod) cluster(workerId)
		
	** Research Index
	
	diff research if tookw2==1,  ///
		period(wave_alt) treated(libmod) cluster(workerId) 	
 
		
********************************************************************************
* Graphing - in Color
********************************************************************************

collapse (mean) scift profft intelft personalgain untrustexp untrustscir polmotive, by(libmodcons wave)

* Scientists

graph twoway (connected scift wave if libmodcons==1, lcolor(blue) mcolor(blue) msymb(Oh) ) ///
	(connected scift wave if libmodcons==2, lcolor(purple) mcolor(purple) lpattern(solid) msymb(Oh)) ///
	(connected scift wave if libmodcons==3, lcolor(red) mcolor(red) lpattern(solid) msymb(Oh)  ///
	scheme(s1mono) ytitle("Thermometer Rating (0 - 1)" " ") ///
	legend(off) ///
		xlab(1 "Wave 1" 2 "Wave 2") xtitle(" " " ") ///
		title("Scientist FT" " "))
		
		graph save "f2a", replace
		
		//graph save "ft_sci", replace
		
* Intellectuals
		
graph twoway (connected intelft wave if libmodcons==1, lcolor(blue) mcolor(blue) msymb(Oh) ) ///
	(connected intelft wave if libmodcons==2, lcolor(purple) mcolor(purple) lpattern(solid) msymb(Oh)) ///
	(connected intelft wave if libmodcons==3, lcolor(red) mcolor(red) lpattern(solid) msymb(Oh)  ///
	scheme(s1mono) ytitle(" " " ") ///
	legend(off) ///
		xlab(1 "Wave 1" 2 "Wave 2") xtitle(" " " ") ///
		title("Intellectual FT" " "))
		
		graph save "f2b", replace
		
		//graph save "ft_intel", replace
		
* Professors
		
graph twoway (connected profft wave if libmodcons==1, lcolor(blue) mcolor(blue) msymb(Oh) ) ///
	(connected profft wave if libmodcons==2, lcolor(purple) mcolor(purple) lpattern(solid) msymb(Oh)) ///
	(connected profft wave if libmodcons==3, lcolor(red) mcolor(red) lpattern(solid) msymb(Oh)  ///
	scheme(s1mono) ytitle( " " " ") ///
	legend(label(1 "Liberals") label(2 "Moderates") label(3 "Conservatives")  ///
		size(small) col(3) pos(6)) ///
		xlab(1 "Wave 1" 2 "Wave 2") xtitle(" " " ") ///
		title("Professor FT" " "))
		
		graph save "f2c", replace
		
* Personal Gain
		
graph twoway (connected personalgain wave if libmodcons==1, lcolor(blue) mcolor(blue) msymb(Oh) ) ///
	(connected personalgain wave if libmodcons==2, lcolor(purple) mcolor(purple) lpattern(solid) msymb(Oh)) ///
	(connected personalgain wave if libmodcons==3, lcolor(red) mcolor(red) lpattern(solid) msymb(Oh)  ///
	scheme(s1mono) ytitle( " " " ") ///
	legend(label(1 "Liberals") label(2 "Moderates") label(3 "Conservatives")  ///
		size(small) col(3) pos(6)) ///
		ytitle("Agreement Level (0-1)" " ") ///
		xlab(1 "Wave 1" 2 "Wave 2") xtitle(" " " ") ///
		title("Personal Gain" " "))
		
		graph save "f2d", replace
		
* Experts = Untrustworthy
		
graph twoway (connected untrustexp wave if libmodcons==1, lcolor(blue) mcolor(blue) msymb(Oh) ) ///
	(connected untrustexp wave if libmodcons==2, lcolor(purple) mcolor(purple) lpattern(solid) msymb(Oh)) ///
	(connected untrustexp wave if libmodcons==3, lcolor(red) mcolor(red) lpattern(solid) msymb(Oh)  ///
	scheme(s1mono) ytitle( " " " ") ///
	legend(label(1 "Liberals") label(2 "Moderates") label(3 "Conservatives")  ///
		size(small) col(3) pos(6)) ///
		xlab(1 "Wave 1" 2 "Wave 2") xtitle(" " " ") ///
		title("Experts Untrust." " "))
		
		graph save "f2e", replace
		
		
* Can't Trust Sci Res.
		
graph twoway (connected untrustscir wave if libmodcons==1, lcolor(blue) mcolor(blue) msymb(Oh)  ) ///
	(connected untrustscir wave if libmodcons==2, lcolor(purple) mcolor(purple) lpattern(solid) msymb(Oh)) ///
	(connected untrustscir wave if libmodcons==3, lcolor(red) mcolor(red) lpattern(solid) msymb(Oh) ///
	scheme(s1mono) ytitle( " " " ") ///
	legend(label(1 "Liberals") label(2 "Moderates") label(3 "Conservatives")  ///
		size(small) col(3) pos(6)) ///
		xlab(1 "Wave 1" 2 "Wave 2") xtitle(" " " ") ///
		title("Can't Trust Res." " "))
		
		graph save "f2f", replace
		
* Pol Motive

graph twoway (connected polmotive wave if libmodcons==1, lcolor(blue) mcolor(blue) msymb(Oh) ) ///
	(connected polmotive wave if libmodcons==2, lcolor(purple) mcolor(purple) lpattern(solid) msymb(Oh)) ///
	(connected polmotive wave if libmodcons==3, lcolor(red) mcolor(red) lpattern(solid) msymb(Oh) ///
	scheme(s1mono) ytitle( " " " ") ///
	legend(label(1 "Liberals") label(2 "Moderates") label(3 "Conservatives")  ///
		size(small) col(3) pos(6)) ///
		xlab(1 "Wave 1" 2 "Wave 2") xtitle(" " " ") ///
		title("Pol. Motive" " "))
		
		graph save "f2g", replace

* Combined

grc1leg "f2a" "f2b" "f2c", ycommon rows(1) legendfrom("f2c") scheme(s1mono)
	graph export "f2.pdf", replace
		
grc1leg "f2d" "f2e" "f2f" "f2g", ycommon rows(1) scheme(s1mono)
	graph export "f3.pdf", replace
	
		
